﻿package pk;

public void writeInSD() throws IOException{  
        String path1 = "/mnt/sdcard/writeTest";  
        File file1 = new File(path1);  
       if(!file1.exists()) file1.mkdir();  
        String fileName = file1 + "/" + "test.txt";  
        BufferedWriter writer = null;  
        try {  
           writer = new BufferedWriter(new FileWriter(fileName));  
            writer.write("Hello world!");  
            writer.newLine();  
            writer.write("This is the writeTest.");  
             
              
       } catch (IOException e) {  

           e.printStackTrace();  
       }finally{  
            writer.flush();  
            writer.close();  
        }  
          
}  
